<template>
  <div>
    <div class="top" :class="[backgroundCss,ba]" >
      <div class="zhezhao">
        <div class="leftImg">
          <img :src="src1" alt="" v-show="searchImg">
          <img :src="asrc" alt="" v-show="searchImg1">
        </div>
        <div class="topRight">
          <div class="toSearch" @click="search"></div>
          <AutoComplete class="search"  v-model="searchValue"  icon="ios-search"  placeholder="输入问题关键字, 如:订单"   @on-search="search" >
            <div class="demo-auto-complete-item" v-for="item in data4">
              <div class="demo-auto-complete-group">
                <span>{{ item.title }}</span>
                <a href="https://www.google.com/search?q=iView" target="_blank">更多</a>
              </div>
              <Option v-for="option in item.children" :value="option.title" :key="option.title">
                <span class="demo-auto-complete-title">{{ option.title }}</span>
                <span class="demo-auto-complete-count">{{ option.count }} 人关注</span>
              </Option>
            </div>
          </AutoComplete>
          <p class="keyword">
            <span>交期查询</span>
            <span>工艺西服</span>
            <span>订单修改</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
    export default{
        name:"banner",
        props:{
          src1:{
              type:String,
            default:""
          },
          backgroundCss:{
              type:String,
            default:""
          }
        },
        data(){
            return {
              searchValue: '',
              searchData: [],
              searchImg:true,
              searchImg1:false,
              asrc:"",
              ba:"",
              data4: [
                {
                  title: '话题',
                  children: [
                    {
                      title: 'iView',
                      count: 10000,

                    },
                    {
                      title: 'iView UI',
                      count: 10600,

                    }
                  ]
                },
                {
                  title: '问题',
                  children: [
                    {
                      title: 'iView UI 有多好',
                      count: 60100,

                    },
                    {
                      title: 'iView 是啥',
                      count: 30010,

                    }
                  ]
                },
                {
                  title: '文章',
                  children: [
                    {
                      title: 'iView 是一个设计语言',
                      count: 100000,

                    }
                  ]
                }
              ]
            }
        },
      methods:{
        search(){
            this.$router.push("/simProblem/search");
            this.searchImg=false;
            this.searchImg1=true;
            this.asrc=require(".././assets/images/banner03.png");
            this.ba="searchPage";
        }
      }
    }
</script>
<style>
  .top{
    width:100%;
    height:200px;
    /*background: #e5eefc;*/
  }
  .index{background: #e5eefc }
  .simProblemPage{background:#feecde }
  .searchPage{background: #ddf1e7 !important}
 .topRight>.toSearch{
    position: absolute;
    right: 0;
    top: 0;
    z-index: 10;
    width: 50px;
    height: 46px;
    background: transparent;
  }
  .zhezhao{
    width: 1120px;
    height: 200px;
    position: relative;
    margin: 0 auto;
  }
  /*左侧小图*/
  .topLeft{
    width:452px;
    margin-left: 212px;
    float: left;
  }
  .leftImg{
    width:452px;
  }
  /*搜索框样式*/
  .topRight{
    width:560px;
    position: absolute;
    top:78px;
    right:0;
  }
 .topRight .iconSearch{
    height: 46px;
    width: 40px;
    background: pink;
    position: absolute;
    right: 0;
    top: 0;
  }
  .topRight .search input{
    display: inline-block;
    width: 100%;
    height: 46px;
    line-height: 46px;
    padding: 0 40px 0 30px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    color: #9ea7b4;
    background-color: #fff;
    background-image: none;
    position: relative;
    cursor: text;
    margin-bottom: 10px;
  }
  .topRight .search i{
    line-height: 46px;
    height:46px;
    font-size: 30px;
    display: inline-block;
    float: right;
    padding-right: 30px;
  }
  .topRight .search input:hover{
    box-shadow: 0 1px 20px #000000;
  }
  .ivu-input:focus{border-color:#fff;box-shadow: none}
  /*搜索框下关键字样式*/
  .topRight>.keyword{
    height: 30px;
    line-height: 30px;
    text-align: left;
    margin-left: 30px;
    font-size: 12px;
    color: #9ea7b4;
  }
  .topRight>.keyword>span{
    cursor: pointer;
  }
  .topRight>.keyword>span:not(:first-child){
    margin-left: 20px;
  }
  /*自动补全下拉框样式*/
  .demo-auto-complete-item{
    padding: 4px 0;
    border-bottom: 1px solid #F6F6F6;
  }
  .demo-auto-complete-group{
    font-size: 12px;
    padding: 4px 6px;
  }
  .demo-auto-complete-group span{
    color: #666;
    font-weight: bold;
  }
  .demo-auto-complete-group a{
    float: right;
  }
  .demo-auto-complete-count{
    float: right;
    color: #999;
  }
  .demo-auto-complete-more{
    display: block;
    margin: 0 auto;
    padding: 4px;
    text-align: center;
    font-size: 12px;
  }

  /*placeholder字体颜色的兼容*/
  /* WebKit browsers*/
  .topRight .search input::-webkit-input-placeholder{color:#9ea7b4;}
  /* Mozilla Firefox 4 to 18*/
  .topRight .search input::-moz-placeholder{color:#9ea7b4;}
  /* Mozilla Firefox 19+*/
  .topRight .search input::-moz-placeholder{color:#9ea7b4;}
  /* Internet Explorer 10+*/
  .topRight .search input:-ms-input-placeholder{color:#9ea7b4;}
</style>
